package com.rygl.staff.mapper;

import java.util.List;

import com.rygl.staff.domain.*;
import com.rygl.staff.domain.Vo.EmployeeDocumentsVo;
import com.rygl.staff.domain.Vo.SalarySocialVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 员工基础信息Mapper接口
 * 
 * @author ruoyi
 * @date 2025-05-06
 */
public interface StaffMapper 
{
    /**
     * 查询员工基础信息
     * 
     * @param id 员工基础信息主键
     * @return 员工基础信息
     */
    @Select("select * from staff where id = #{id}")
    public Staff selectStaffById(Long id);

    /**
     * 查询员工基础信息列表
     * 
     * @param staff 员工基础信息
     * @return 员工基础信息集合
     */
    public List<Staff1> selectStaffList(Staff1 staff);

    /**
     * 新增员工基础信息
     * 
     * @param staff 员工基础信息
     * @return 结果
     */
    public int insertStaff(Staff1 staff);

    /**
     * 修改员工基础信息
     * 
     * @param staff 员工基础信息
     * @return 结果
     */
    public int updateStaff(Staff1 staff);

    /**
     * 删除员工基础信息
     * 
     * @param id 员工基础信息主键
     * @return 结果
     */
    public int deleteStaffById(Long id);

    /**
     * 批量删除员工基础信息
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteStaffByIds(Long[] ids);

    /**
     * 根据EducationExperiences
     *
     * @param id 员工基础信息主键
     * @return 结果
     */
    @Select("select * from education_experience where user_id = #{id}")
    List<EducationExperience> selectEducationExperiences(Long id);

    @Select("select * from certificate where user_id = #{id}")
    List<Certificate> selectCertificates(Long id);

    @Select("select * from work_experience where user_id = #{id}")
    List<WorkExperience> selectWorkExperiences(Long id);

    @Select("select * from training_experience where user_id = #{id}")
    List<TrainingExperience> selectTrainingExperiences(Long id);

    @Select("select * from job_assignment where user_id = #{id}")
    JobAssignment selectJobById(Long id);

    @Select("select * from salary_social_account where user_id= #{id}")
    SalarySocialVO selectSalaryById(Long id);

    @Select("select * from salary_records where employee_id=#{id} order by salary_month desc")
    List<SalaryRecords> selectSalaryRecordsById(Long id);

    @Select("SELECT * FROM employee_documents WHERE employee_id = #{id} and document_type= #{type}")
    List<EmployeeDocumentsVo> selectDocumentsByEmployeeId(@Param("id") Long id, @Param("type") Integer type);

    @Select("SELECT * FROM staff_operation_log WHERE user_id = #{id} order by operation_time desc")
    List<StaffOperationLog> selectOperationLogByUserId(Long id);

    @Select("SELECT * FROM staff_transfer_log WHERE user_id = #{id} order by operation_time desc")
    List<StaffTransferLog> selectTransferLogByUserId(Long id);

    @Select("select * from employment_contract where user_id= #{id} ")
    List<EmploymentContract> selectStaffContract(Long id);
}
